﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
/// <summary>
///sqldata 的摘要说明
/// </summary>
public class sqldata
{
	public sqldata()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}
    public void gridviewdatabind(string str, GridView grv)
    {
        DataSet ds = new DataSet();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        sda.Fill(ds);
        grv.DataSource = ds;
        grv.DataBind();
        con.Close();
    }
    public void dropdownlistdatabind(string str, DropDownList ddl)
    {
        DataSet ds = new DataSet();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        sda.Fill(ds);
        ddl.DataSource = ds;
        ddl.DataBind();
        con.Close();
    }
}
